package com.hellobike.haxing.modules.supplier.consumer;

import com.hellobike.haxing.modules.purchase.dto.TPurchaseProDto;
import com.hellobike.haxing.modules.purchase.service.ITPurchaseProService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author ZLB
 * @Date 2020/2/9
 * @Version 1.0
 **/
@Slf4j
@Component
@Data
@RocketMQMessageListener(consumerGroup = "backend_t_sku", topic = "t_sku")
public class SkuConsumer implements RocketMQListener<String> {
    @Autowired
    private ITPurchaseProService itPurchaseProService;

    @Override
    public void onMessage(String id) {
        log.info("==========数据表[{}]更新，ID为[{}]==========", "t_sku", id);
        TPurchaseProDto tPurchaseProDto = new TPurchaseProDto();
        tPurchaseProDto.setSkuId(Long.valueOf(id));
        itPurchaseProService.syncProAndClp(tPurchaseProDto);
    }


}
